// let buff = Buffer.alloc(10,'abc');
let buff = Buffer.alloc(10,'我是好人呐');

console.log(buff); //<Buffer 00 00 00 00 00 00 00 00 00 00>

let str = '天气真不错';

let buff2 = Buffer.from(str);

buff2[5] = 61;

console.log(buff2); //<Buffer e5 a4 a9 e6 b0 94 e7 9c 9f e4 b8 8d e9 94 99>

// 如果 我收到buffer格式的数据，变成字符串。
let toStr = buff2.toString();

console.log(toStr);

